package cool.webstudy.admin.utils;

import cool.webstudy.admin.model.dto.user.UserDetailInfoDTO;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 *
 * @author think
 * @date 2024/7/18 13:51
 * @description: 当前登录用户信息工具类
 */
public class UserDetailUtil {
    /**
     * @return UserDetailInfoDTO
     * @description: 获取当前登录用户信息
     */
    public static UserDetailInfoDTO getUserDetailInfo(){
        UserDetailInfoDTO userDetailInfoDTO = (UserDetailInfoDTO) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return userDetailInfoDTO;
    }
}
